Xbasic

*xml_peek_attribute Function

Syntax

C *XML_PEEK_ATTRIBUTE(xmltext as c,attribute as c)

Arguments

xmltextCharacter

A string containing XML.

attributeCharacter

The attribute to check in the top-level element in the XML.

Returns

resultCharacter

Returns the value of the attribute. If the attribute doesn't exist, an empty string is returned.

Description

Peeks at an attribute in top xml element.

Example

dim xml as c =<<%xml%
<name city-name="boston" state-name="ma" age="27">
    Fred Smith
</name>
%xml%

? *xml_peek_attribute(xml,"state-name")
= "ma"

? *xml_peek_attribute(xml,"age")
= "27"

? *xml_peek_attribute(xml,"lastname")
= ""

See Also